﻿/*MyPhotoIndex Free Photo Organizer <www.myphotoindex.com>
  Copyright (C) <2006-2009>  <Asaf Yarkoni asaf@yarkoni.net>

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.*/
using System;
using System.Collections.Generic;
using System.Text;
using MyPhotoIndex.Interfaces.Plugins;
using System.Collections.ObjectModel;
using System.Drawing;

namespace MyPhotoIndex.Interfaces.Plugins
{
    public class PluginMenuInfo : IPluginMenuInfo
    {
        private Guid m_menuItemId;
        private string m_name;
        private Image m_icon;

        #region IPluginMenuInfo Members

        public void PerformClick(ReadOnlyCollection<int> selectedImages)
        {
            if (MenuItemClick != null)
            {
                MenuItemClick(null, new PluginMenuClickEventArgs(this, selectedImages));
            }
        }

        public event EventHandler<PluginMenuClickEventArgs> MenuItemClick;

        public Guid MenuItemId
        {
            get { return m_menuItemId; }
            set { m_menuItemId = value; }
        }

        public string Name
        {
            get { return m_name; }
            set { m_name = value; }
        }

        public Image Icon
        {
            get { return m_icon; }
            set { m_icon = value; }
        }

        public void QueryMenuState(ReadOnlyCollection<int> selectedImages, out bool enabled)
        {
            enabled = true;

            if (MenuItemQueryState != null)
            {
                PluginMenuStateQueryEventArgs pmsqe = new PluginMenuStateQueryEventArgs(this, selectedImages);
                MenuItemQueryState(null, pmsqe);
                enabled = pmsqe.Enabled;
            }
        }

        public event EventHandler<PluginMenuStateQueryEventArgs> MenuItemQueryState;

        #endregion
    }
}
